import { SettingsModel } from '../../models/Settings'

export default defineEventHandler(async (event) => {
  try {
    const heroSection = await SettingsModel.getHeroSection()
    
    if (!heroSection || Object.keys(heroSection).length === 0) {
      return {
        success: false,
        message: '英雄区块信息不存在',
        data: null
      }
    }

    return {
      success: true,
      message: '获取英雄区块信息成功',
      data: heroSection
    }
  } catch (error: any) {
    console.error('获取英雄区块信息失败:', error)
    
    return {
      success: false,
      message: `获取英雄区块信息失败: ${error.message}`,
      data: null
    }
  }
})